package jscinttools.datafit;

import hep.aida.*;

import java.lang.Double;

import jscinttools.datafit.*;
import jscinttools.datafit.scint.*;

/**
 *  Class to Prepare the Fitting Parameters
 *
 *@author     Marc-Antoine Verdier
 *@created    8 avril 2011
 */
public class FitSettings
{
	double[] startParam;
	boolean[] fixed;
	//double[][] bounds;
	double[] upperBound;
	double[] lowerBound;


	//double[] step;

	/**
	 *  Constructor for the FitSettings object
	 *
	 *@param  startParam  Description of the Parameter
	 */
	public FitSettings(double[] startParam)
	{
		this.startParam = startParam;
		this.fixed = new boolean[startParam.length];
		this.upperBound = new double[startParam.length];
		this.lowerBound = new double[startParam.length];
		//this.step = new double[startParam.length];
		for (int i = 0; i < startParam.length; i++)
		{
			fixed[i] = false;
			lowerBound[i] = Double.NEGATIVE_INFINITY;
			upperBound[i] = Double.POSITIVE_INFINITY;
			//step[i] = Double.POSITIVE_INFINITY;
		}
	}


	///**
	// *  Constructor for the FitSettings object
	// */
	//public FitSettings() { }
	//
	//
	///**
	// *  Constructor for the FitSettings object
	// *
	// *@param  startParam  Starting values for the fit
	// *@param  fixed       fixe or not the values for the fit (default is false)
	// *@param  bounds      The boundary conditions of the values for the fit (lower
	// *      and upper)
	// */
	//public FitSettings(double[] startParam, boolean[] fixed, double[][] bounds)
	//{
	//	this.startParam = startParam;
	//	this.fixed = fixed;
	//	this.bounds = bounds;
	//}
	//
	//
	///**
	// *  Constructor for the FitSettings object
	// *
	// *@param  startParam  Starting values for the fit
	// *@param  fixed       fixe or not the values for the fit (default is false)
	// */
	//public FitSettings(double[] startParam, boolean[] fixed)
	//{
	//	this.startParam = startParam;
	//	this.fixed = fixed;
	//	this.bounds = new double[startParam.length][2];
	//	for (int i = 0; i < startParam.length; i++)
	//	{
	//		bounds[i][0] = Double.NEGATIVE_INFINITY;
	//		bounds[i][1] = Double.POSITIVE_INFINITY;
	//	}
	//}
	//
	//
	///**
	// *  Constructor for the FitSettings object
	// *
	// *@param  startParam  Starting values for the fit
	// *@param  bounds      The boundary conditions of the values for the fit (lower
	// *      and upper)
	// */
	//public FitSettings(double[] startParam, double[][] bounds)
	//{
	//	this.startParam = startParam;
	//	this.bounds = bounds;
	//	this.fixed = new boolean[startParam.length];
	//	for (int i = 0; i < startParam.length; i++)
	//	{
	//		fixed[i] = false;
	//	}
	//}
	//
	//
	///**
	// *  Constructor for the FitSettings object
	// *
	// *@param  startParam  Starting values for the fit
	// */
	//public FitSettings(double[] startParam)
	//{
	//	this.startParam = startParam;
	//	this.fixed = new boolean[startParam.length];
	//	this.bounds = new double[startParam.length][2];
	//	for (int i = 0; i < startParam.length; i++)
	//	{
	//		fixed[i] = false;
	//		bounds[i][0] = Double.NEGATIVE_INFINITY;
	//		bounds[i][1] = Double.POSITIVE_INFINITY;
	//	}
	//}


	///**
	// *  Gives the parameters to the fitter
	// *
	// *@param  fitter  The IFitter
	// *@param  func    The IFunction
	// *@param  i       The index
	// *@return         The IFitParameterSettings
	// */
	//public IFitParameterSettings fitSettings(IFitter fitter, IFunction func, int i)
	//{
	//	IFitParameterSettings fitParamSet = fitter.fitParameterSettings(func.parameterNames()[i]);
	//	fitParamSet.setFixed(fixed[i]);
	//	fitParamSet.setBounds(bounds[i][0], bounds[i][1]);
	//	return fitParamSet;
	//}
	//
	//
	///**
	// *  Gives the parameters to the fitter
	// *
	// *@param  fitter  The IFitter
	// *@param  func    The IFunction
	// *@return         The IFitParameterSettings
	// */
	//public IFitParameterSettings[] fitSettings(IFitter fitter, IFunction func)
	//{
	//	IFitParameterSettings[] fitParamSet = new IFitParameterSettings[func.parameterNames().length];
	//	for (int i = 0; i < func.parameterNames().length; i++)
	//	{
	//		fitParamSet[i] = fitter.fitParameterSettings(func.parameterNames()[i]);
	//		fitParamSet[i].setFixed(fixed[i]);
	//		fitParamSet[i].setBounds(bounds[i][0], bounds[i][1]);
	//	}
	//	return fitParamSet;
	//}


	/**
	 *  Sets the startParam attribute of the FitSettings object
	 *
	 *@param  startParam  Starting values for the fit
	 */
	public void setStartParam(double[] startParam)
	{
		this.startParam = startParam;
	}


	/**
	 *  Description of the Method
	 *
	 *@return    Starting values for the fit
	 */
	public double[] getStartParam()
	{
		return startParam;
	}


	/**
	 *  Description of the Method
	 *
	 *@param  startParam  Starting values for the fit
	 *@param  i           Description of the Parameter
	 */
	public void setStartParam(double startParam, int i)
	{
		this.startParam[i] = startParam;
	}


	/**
	 *  Description of the Method
	 *
	 *@param  i  Description of the Parameter
	 *@return    Starting values for the fit
	 */
	public double getStartParam(int i)
	{
		return startParam[i];
	}


	/**
	 *  Sets the fixed attribute of the FitSettings object
	 *
	 *@param  fixed  fixe or not the values for the fit (default is false)
	 */
	public void setFixed(boolean[] fixed)
	{
		this.fixed = fixed;
	}


	/**
	 *  Gets the fixed attribute of the FitSettings object
	 *
	 *@return    fixe or not the values for the fit (default is false)
	 */
	public boolean[] isFixed()
	{
		return fixed;
	}


	/**
	 *  Sets the fixed attribute of the FitSettings object
	 *
	 *@param  fixed  fixe or not the values for the fit (default is false)
	 *@param  i      The new fixed value
	 */
	public void setFixed(boolean fixed, int i)
	{
		this.fixed[i] = fixed;
	}


	/**
	 *  Gets the fixed attribute of the FitSettings object
	 *
	 *@param  i  Description of the Parameter
	 *@return    fixe or not the values for the fit (default is false)
	 */
	public boolean isFixed(int i)
	{
		return fixed[i];
	}


	/**
	 *  Sets the upperBound attribute of the FitSettings object
	 *
	 *@param  upperBound  The new upperBound value
	 */
	public void setUpperBound(double[] upperBound)
	{
		this.upperBound = upperBound;
	}


	/**
	 *  Gets the upperBound attribute of the FitSettings object
	 *
	 *@return    The upperBound value
	 */
	public double[] getUpperBound()
	{
		return upperBound;
	}


	/**
	 *  Sets the upperBound attribute of the FitSettings object
	 *
	 *@param  upperBound  The new upperBound value
	 *@param  i           The new upperBound value
	 */
	public void setUpperBound(double upperBound, int i)
	{
		this.upperBound[i] = upperBound;
	}


	/**
	 *  Gets the upperBound attribute of the FitSettings object
	 *
	 *@param  i  Description of the Parameter
	 *@return    The upperBound value
	 */
	public double getUpperBound(int i)
	{
		return upperBound[i];
	}


	/**
	 *  Sets the lowerBound attribute of the FitSettings object
	 *
	 *@param  lowerBound  The new lowerBound value
	 */
	public void setLowerBound(double[] lowerBound)
	{
		this.lowerBound = lowerBound;
	}


	/**
	 *  Gets the lowerBound attribute of the FitSettings object
	 *
	 *@return    The lowerBound value
	 */
	public double[] getLowerBound()
	{
		return lowerBound;
	}


	/**
	 *  Sets the lowerBound attribute of the FitSettings object
	 *
	 *@param  lowerBound  The new lowerBound value
	 *@param  i           The new lowerBound value
	 */
	public void setLowerBound(double lowerBound, int i)
	{
		this.lowerBound[i] = lowerBound;
	}


	/**
	 *  Gets the lowerBound attribute of the FitSettings object
	 *
	 *@param  i  Description of the Parameter
	 *@return    The lowerBound value
	 */
	public double getLowerBound(int i)
	{
		return lowerBound[i];
	}

	///**
	// *  Sets the bounds attribute of the FitSettings object
	// *
	// *@param  bounds  The boundary conditions of the values for the fit (lower and
	// *      upper)
	// */
	//public void setBounds(double[][] bounds)
	//{
	//	this.bounds = bounds;
	//}
	//
	//
	///**
	// *  Description of the Method
	// *
	// *@return    The boundary conditions of the values for the fit (lower and
	// *      upper)
	// */
	//public double[][] getBounds()
	//{
	//	return bounds;
	//}
	//
	//
	///**
	// *  Sets the bounds attribute of the FitSettings object
	// *
	// *@param  i       The new bounds value
	// *@param  bounds  The boundary conditions of the values for the fit (lower and
	// *      upper)
	// */
	//public void setBounds(double[] bounds, int i)
	//{
	//	this.bounds[i] = bounds;
	//}
	//
	//
	///**
	// *  Description of the Method
	// *
	// *@param  i  Description of the Parameter
	// *@return    The boundary conditions of the values for the fit (lower and
	// *      upper)
	// */
	//public double[] getBounds(int i)
	//{
	//	return bounds[i];
	//}
	//
	//
	///**
	// *  Sets the bounds attribute of the FitSettings object
	// *
	// *@param  i       The new bounds value
	// *@param  j       The new bounds value
	// *@param  bounds  The boundary conditions of the values for the fit (lower and
	// *      upper)
	// */
	//public void setBounds(double bounds, int i, int j)
	//{
	//	this.bounds[i][j] = bounds;
	//}
	//
	//
	///**
	// *  Description of the Method
	// *
	// *@param  i  Description of the Parameter
	// *@param  j  Description of the Parameter
	// *@return    The boundary conditions of the values for the fit (lower and
	// *      upper)
	// */
	//public double getBounds(int i, int j)
	//{
	//	return bounds[i][j];
	//}
}

